<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
iframe
<button id="btn" type="button">btn</button>
<script type="module">
  import * as Lib from './server1/message.js'
  Lib.onMessage(function (name, value) {
    if (name === Lib.READY_FLAG) {
      console.log('初始化成功', value)
    } else {
      console.log('iframe', name, value)
    }
  })

  document.addEventListener('DOMContentLoaded', function () {
    document.getElementById('btn').addEventListener('click', function () {
      // alert(1)
      Lib.sendMessage('test:iframe:click', {
        now: Date.now()
      })
    })
  })
</script>
</body>
</html>
